home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1989-10-13  |  5.6 KB  |  231 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Tuesday, August 2, 1988 at 7:44 AM
  3.     Fonts.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.     Copyright Apple Computer, Inc.    1985-1988
  7.     All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Fonts;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingFonts}
  21. {$SETC UsingFonts := 1}
  22.  
  23. {$I+}
  24. {$SETC FontsIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$SETC UsingIncludes := FontsIncludes}
  30.  
  31. CONST
  32. systemFont = 0;
  33. applFont = 1;
  34. newYork = 2;
  35. geneva = 3;
  36. monaco = 4;
  37. venice = 5;
  38. london = 6;
  39. athens = 7;
  40. sanFran = 8;
  41. toronto = 9;
  42. cairo = 11;
  43. losAngeles = 12;
  44. times = 20;
  45. helvetica = 21;
  46. courier = 22;
  47. symbol = 23;
  48. mobile = 24;
  49. commandMark = 17;
  50. checkMark = 18;
  51. diamondMark = 19;
  52. appleMark = 20;
  53. propFont = 36864;
  54. prpFntH = 36865;
  55. prpFntW = 36866;
  56. prpFntHW = 36867;
  57. fixedFont = 45056;
  58. fxdFntH = 45057;
  59. fxdFntW = 45058;
  60. fxdFntHW = 45059;
  61. fontWid = 44208;
  62.  
  63.  
  64. TYPE
  65.  
  66. FMInput = PACKED RECORD
  67.     family: INTEGER;
  68.     size: INTEGER;
  69.     face: Style;
  70.     needBits: BOOLEAN;
  71.     device: INTEGER;
  72.     numer: Point;
  73.     denom: Point;
  74.     END;
  75.  
  76. FMOutPtr = ^FMOutput;
  77. FMOutput = PACKED RECORD
  78.     errNum: INTEGER;
  79.     fontHandle: Handle;
  80.     bold: Byte;
  81.     italic: Byte;
  82.     ulOffset: Byte;
  83.     ulShadow: Byte;
  84.     ulThick: Byte;
  85.     shadow: Byte;
  86.     extra: SignedByte;
  87.     ascent: Byte;
  88.     descent: Byte;
  89.     widMax: Byte;
  90.     leading: SignedByte;
  91.     unused: Byte;
  92.     numer: Point;
  93.     denom: Point;
  94.     END;
  95.  
  96. FontRec = RECORD
  97.     fontType: INTEGER;                        {font type}
  98.     firstChar: INTEGER;                     {ASCII code of first character}
  99.     lastChar: INTEGER;                        {ASCII code of last character}
  100.     widMax: INTEGER;                        {maximum character width}
  101.     kernMax: INTEGER;                        {negative of maximum character kern}
  102.     nDescent: INTEGER;                        {negative of descent}
  103.     fRectWidth: INTEGER;                    {width of font rectangle}
  104.     fRectHeight: INTEGER;                    {height of font rectangle}
  105.     owTLoc: INTEGER;                        {offset to offset/width table}
  106.     ascent: INTEGER;                        {ascent}
  107.     descent: INTEGER;                        {descent}
  108.     leading: INTEGER;                        {leading}
  109.     rowWords: INTEGER;                        {row width of bit image / 2 }
  110.     END;
  111.  
  112. FMetricRec = RECORD
  113.     ascent: Fixed;                            {base line to top}
  114.     descent: Fixed;                         {base line to bottom}
  115.     leading: Fixed;                         {leading between lines}
  116.     widMax: Fixed;                            {maximum character width}
  117.     wTabHandle: Handle;                     {handle to font width table}
  118.     END;
  119.  
  120. WidEntry = RECORD
  121.     widStyle: INTEGER;                        {style entry applies to}
  122.     END;
  123.  
  124. WidTable = RECORD
  125.     numWidths: INTEGER;                     {number of entries - 1}
  126.     END;
  127.  
  128. AsscEntry = RECORD
  129.     fontSize: INTEGER;
  130.     fontStyle: INTEGER;
  131.     fontID: INTEGER;                        {font resource ID}
  132.     END;
  133.  
  134. FontAssoc = RECORD
  135.     numAssoc: INTEGER;                        {number of entries - 1}
  136.     END;
  137.  
  138. StyleTable = RECORD
  139.     fontClass: INTEGER;
  140.     offset: LONGINT;
  141.     reserved: LONGINT;
  142.     indexes: ARRAY [0..47] OF SignedByte;
  143.     END;
  144.  
  145. NameTable = RECORD
  146.     stringCount: INTEGER;
  147.     baseFontName: Str255;
  148.     END;
  149.  
  150. KernPair = RECORD
  151.     kernFirst: CHAR;                        {1st character of kerned pair}
  152.     kernSecond: CHAR;                        {2nd character of kerned pair}
  153.     kernWidth: INTEGER;                     {kerning in 1pt fixed format}
  154.     END;
  155.  
  156. KernEntry = RECORD
  157.     kernLength: INTEGER;                    {length of this entry}
  158.     kernStyle: INTEGER;                     {style the entry applies to}
  159.     END;
  160.  
  161. KernTable = RECORD
  162.     numKerns: INTEGER;                        {number of kerning entries}
  163.     END;
  164.  
  165. WidthTable = PACKED RECORD
  166.     tabData: ARRAY [1..256] OF Fixed;        {character widths}
  167.     tabFont: Handle;                        {font record used to build table}
  168.     sExtra: LONGINT;                        {space extra used for table}
  169.     style: LONGINT;                         {extra due to style}
  170.     fID: INTEGER;                            {font family ID}
  171.     fSize: INTEGER;                         {font size request}
  172.     face: INTEGER;                            {style (face) request}
  173.     device: INTEGER;                        {device requested}
  174.     inNumer: Point;                         {scale factors requested}
  175.     inDenom: Point;                         {scale factors requested}
  176.     aFID: INTEGER;                            {actual font family ID for table}
  177.     fHand: Handle;                            {family record used to build up table}
  178.     usedFam: BOOLEAN;                        {used fixed point family widths}
  179.     aFace: Byte;                            {actual face produced}
  180.     vOutput: INTEGER;                        {vertical scale output value}
  181.     hOutput: INTEGER;                        {horizontal scale output value}
  182.     vFactor: INTEGER;                        {vertical scale output value}
  183.     hFactor: INTEGER;                        {horizontal scale output value}
  184.     aSize: INTEGER;                         {actual size of actual font used}
  185.     tabSize: INTEGER;                        {total size of table}
  186.     END;
  187.  
  188. FamRec = RECORD
  189.     ffFlags: INTEGER;                        {flags for family}
  190.     ffFamID: INTEGER;                        {family ID number}
  191.     ffFirstChar: INTEGER;                    {ASCII code of 1st character}
  192.     ffLastChar: INTEGER;                    {ASCII code of last character}
  193.     ffAscent: INTEGER;                        {maximum ascent for 1pt font}
  194.     ffDescent: INTEGER;                     {maximum descent for 1pt font}
  195.     ffLeading: INTEGER;                     {maximum leading for 1pt font}
  196.     ffWidMax: INTEGER;                        {maximum widMax for 1pt font}
  197.     ffWTabOff: LONGINT;                     {offset to width table}
  198.     ffKernOff: LONGINT;                     {offset to kerning table}
  199.     ffStylOff: LONGINT;                     {offset to style mapping table}
  200.     ffProperty: ARRAY [1..9] OF INTEGER;    {style property info}
  201.     ffIntl: ARRAY [1..2] OF INTEGER;        {for international use}
  202.     ffVersion: INTEGER;                     {version number}
  203.     END;
  204.  
  205.  
  206.  
  207. PROCEDURE InitFonts;
  208.     INLINE $A8FE;
  209. PROCEDURE GetFontName(familyID: INTEGER;VAR theName: Str255);
  210.     INLINE $A8FF;
  211. PROCEDURE GetFNum(theName: Str255;VAR familyID: INTEGER);
  212.     INLINE $A900;
  213. FUNCTION RealFont(fontNum: INTEGER;size: INTEGER): BOOLEAN;
  214.     INLINE $A902;
  215. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  216.     INLINE $A903;
  217. FUNCTION FMSwapFont(inRec: FMInput): FMOutPtr;
  218.     INLINE $A901;
  219. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  220.     INLINE $A834;
  221. PROCEDURE FontMetrics(theMetrics: FMetricRec);
  222.     INLINE $A835;
  223. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  224.  
  225. {$ENDC}    { UsingFonts }
  226.  
  227. {$IFC NOT UsingIncludes}
  228.     END.
  229. {$ENDC}
  230.  
  231.